#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int > vec;
typedef pair < int , int > pii;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

int a[10];

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	rep(i, 1, 7) a[i] = in;
	ll ans = a[2];
	if(!a[1] || !a[4] || !a[5]) ans += a[1] / 2 * 2, ans += a[4] / 2 * 2, ans += a[5] / 2 * 2;
	else {
		ans += a[1]; ans += a[4]; ans += a[5];
		if(a[1] % 2 != a[4] % 2 || a[4] % 2 != a[5] % 2) ans--;
	} cout << ans << endl;
}
